<?php

class ContactForm {
  
    /*
     * Get Group Travel when submit
     * @param $start int
     * @paran $limit int
     * @return $listGroupTravel
     */
    public static function ListContactForm($start,$limit){
        global $wpdb;
	$sql = 'SELECT DISTINCT(`submit_time`) FROM `travel_cf7dbplugin_submits`
               LIMIT '.$start." , ".$limit;
        
        $listGroupTravel = $wpdb->get_results($sql);
	return $listGroupTravel;
    }
      /*
     * Get Group Travel when submit by Id Submit Time
     * @param $id_time int
     * @return $listGroupTravel
     */
    public static function getInfoByIdSubmitTime($id_time){
        
        global $wpdb;
        $infoGroupTravel = "";
	$sql = 'SELECT * FROM `travel_cf7dbplugin_submits` WHERE `submit_time`='.$id_time;
        
        $listGroupTravel = $wpdb->get_results($sql);
        
        foreach ($listGroupTravel as $groupTravel){
            
            $fieldName =  $groupTravel->field_name;
            $fieldValue = $groupTravel->field_value;
            $infoGroupTravel[$fieldName] = $fieldValue;   
        }
        
        return  $infoGroupTravel;
        
        
    }
    
}